import config from 'config'
import httpFetch from 'share/httpFetch'

export default {

  searchCites(keyword, country, language) {
    if (language === 'en_us') {
      language = 'en';
    }
    let params = {
      keyword,
      language,
      country
    };
    return httpFetch.get(`${config.baseUrl}/location-service/api/custom/location/search/keyword`, params);
  },

  // 获取差补规则
  getExpenseTypes(params){
    return httpFetch.post(`${config.baseUrl}/api/expense/report/v4/subsidy/add`, params);
  },

  // 更改大行程
  changeDate(params){
    return httpFetch.post(`${config.baseUrl}/api/v3/subsidy/extend/update`, params);
  },

  // 保存差补
  saveDataList(expenseReportOID, params){
    return httpFetch.post(`${config.baseUrl}/api/expense/report/v3/subsidy/save/${expenseReportOID}`, params)
  },

  // 获取补贴详情
  getDataList(expenseOid){
    return httpFetch.get(`${config.baseUrl}/api/expense/report/v3/subsidy/view?expenseReportOID=${expenseOid}`)
  },

  getUserList(expenseOid){
    return httpFetch.get(`${config.baseUrl}/api/expense/report/invoices/owner/search?expenseReportOID=${expenseOid}&page=0&size=100`)
  },

  checkSubsidy(params){
    return httpFetch.post(`${config.baseUrl}/api/expense/report/v2/subsidy/check`,params)
  },

  //自动计算行程
  getAutoSubsidy(params) {
    return httpFetch.get(`${config.baseUrl}/api/expense/report/auto/subsidy`, params)
  },

  //获取差补值列表
  getSubsidyRules(params){
    return httpFetch.get(`${config.baseUrl}/api/expense/report/subsidy/enumeration`, params)
  }

}
